<?php

	$operation = Jpublic::get('operation');

	$id = Jpublic::get('id');
	
	$dt = Jdb::select("SELECT * FROM `" . PRE . "plugin_menu` WHERE webosPluginMenuID = (SELECT pmParentID FROM `" . PRE . "plugin_menu` WHERE webosPluginMenuID = $id)");
	
	$parentNmae = $dt['pmName'];
	
	switch ($operation) {
		
		case 'update':
		
			$info = Jdb::select("SELECT * FROM `" . PRE . "plugin_menu` WHERE webosPluginMenuID = $id");		
		
		break;
		
	};
	
	if ($parentNmae == '') {
		
		$parentNmae = '顶级';
		
	}

?>
<script>
	var check = function (obj) {
		
		var val = $(obj).find('input:[name=pmName]').val().trim();
		
		if (val.length <= 0) {
			
			layer.alert('类别名称不允许为空');
			
			return false;
			
		}
		
		return true;
		
	}
</script>
<form action="<?php echo ACTION . '?action=admin&mod=set-application-class/class-form-server&type=' . $operation . '&id=' . $id . '&formhash=' . JAdmin_core::formHASH();?>" method="post" onsubmit="return check(this);">
	<div class="table-div">
		<table cellpadding="5" class="width-100">
			<tr>
				<td>
					上一级：<span class="impor"><?php echo $parentNmae;?></span>
				</td>
			</tr>
			<tr>
			
				<td>
					<input type="text" name="pmName" placeholder="请填写类别名称" value="<?php echo $info['pmName'];?>" class="text" />
				</td>
				
			</tr>
			<tr>
			
				<td>
					<input type="text" name="pmSort" placeholder="请填写排序号" value="<?php echo $info['pmSort'];?>" class="text" /> 只能填写整数
				</td>
				
			</tr>
			<tr>
				<td><button type="submit" class="button">提交</button></td>
			</tr>
		</table>
	</div>
</form>